package com.ctshk.common.enums;

import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.Setter;

/**
 * @author 谢诗宏
 * @description 单项产品来源
 * @date 2021/3/11
 */
@AllArgsConstructor
public enum TicketSourceType {

    // 单项产品来源
    MANUAL(1, "人工錄入"),
    API(2, "API錄入"),
    PLUG(3, "外掛單");
    ;

    @Getter
    @Setter
    private int code;

    @Getter
    @Setter
    private String value;

    public static String parseValue(int code){
        for (TicketSourceType type : TicketSourceType.values()) {
            if (type.code == code) {
                return type.getValue();
            }
        }
        return null;
    }
}
